how to validate an input field’s length with JavaScript